<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>（我的岗位）学生个人岗位申请记录</title>
    <link rel="stylesheet" href="../../dist/css/layui.css">
</head>
<body>

<table id="demo" lay-filter="test"></table>


<script src="../../dist/layui.js"></script>
<script>
    layui.use(['layer', 'form'], function(){
        var layer = layui.layer
            ,form = layui.form
            ,$ = layui.jquery
    });
    layui.use('table', function(){
        var table = layui.table;

        //第一个实例
        table.render({
            elem: '#demo'
            ,height: "full-20"
            ,url: '/student/selectAllWorkApplication' //数据接口
            ,page: {
                limit : 10,
                limits: [5, 10]
            } //开启分页
            ,cols: [[ //表头
                {field: 'year', title: '学年',align: "center", width:'10%', sort: true}
                ,{field: 'term', title: '学期',align: "center", width:'10%'}
                ,{field: 'dept', title: '隶属部门',align: "center", width:'10%'}
                ,{field: 'work', title: '岗位',align: "center", width:'10%'}
                ,{field: 'counselorStatus', title: '辅导员审批状态',align: "center", width:'13%', templet: '#counselorTpl'}
                ,{field: 'deptStatus', title: '用工部门审批状态',align: "center", width:'13%', templet: '#deptTpl'}
                ,{field: 'adminStatus', title: '管理员审批状态',align: "center", width:'13%', templet: '#adminTpl'}
                ,{field: 'operation', title: '操作',  width: '20%', align:'center', toolbar: '#barDemo'}

            ]]
        });

        // 操作选项
        table.on('tool(test)', function (obj) {

            // 本行数据
            var data = obj.data;
            switch (obj.event) {
                case "detail" :
                    layer.open({
                        title: '岗位详情',
                        type:0,
                        content:data.detail.toString(),
                        icon: 6
                    });
                    break;

                case "attitude" :
                    layer.open({
                        title: '审核意见',
                        type:0,
                        content:data.attitude.toString(),
                        icon: 6
                    });
                    break;
            }
        });
    });
</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="detail">岗位详情</a>
    <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="attitude">审核意见</a>
</script>
<script type="text/html" id="counselorTpl">
    {{#  if(d.counselorStatus == '通过'){ }}
    <span style="color: mediumseagreen;">{{ d.counselorStatus }}</span>
    {{# } else if(d.counselorStatus == '拒绝'){ }}
    <span style="color: orangered;">{{ d.counselorStatus }}</span>
    {{# } else { }}
    <span style="color: deepskyblue;">{{ d.counselorStatus }}</span>
    {{#  } }}
</script>
<script type="text/html" id="deptTpl">
    {{#  if(d.deptStatus == '通过'){ }}
    <span style="color: mediumseagreen;">{{ d.deptStatus }}</span>
    {{# } else if(d.deptStatus == '拒绝'){ }}
    <span style="color: orangered;">{{ d.deptStatus }}</span>
    {{# } else { }}
    <span style="color: deepskyblue;">{{ d.deptStatus }}</span>
    {{#  } }}
</script>
<script type="text/html" id="adminTpl">
    {{#  if(d.adminStatus == '通过'){ }}
    <span style="color: mediumseagreen;">{{ d.adminStatus }}</span>
    {{# } else if(d.adminStatus == '拒绝'){ }}
    <span style="color: orangered;">{{ d.adminStatus }}</span>
    {{# } else { }}
    <span style="color: deepskyblue;">{{ d.adminStatus }}</span>
    {{#  } }}
</script>
</body>
</html>
